<layout name="layout" />
<div class="pageheader notab">
	<!--<h1 class="pagetitle" id="campaign_title">我思故我牛</h1>-->
	<h1 class="pagetitle">
		<a href="/" class="linkWay">首页/思路优化</a>
		&nbsp;<span class="divider">»</span>&nbsp;
		<a href="#" class="currentWay">平台思路</a>
	</h1>
	<!--<ul class="breadcrumbs breadcrumbs2"  >
		<li><a href="/algorithm">我思故我牛</a><span class="divider">&#187;</span></li>
		<li>平台思路{$viewType}</li>
	</ul>-->
</div>
<link rel="stylesheet" href="/Css/silu/silu-platform.css">
<div clear="all"></div>
<div id="contentwrapper" class="contentwrapper">
	<div id="maincontent" <if condition="$viewType eq view">style="text-align:center"</if>>
	<if condition="$viewType eq view">
		<if condition="$menu">
			<div class="platform-silu">
				<foreach name="menu" item="vo" key="ky">
					<div class="menu-box">
						<div class="menu-box-name">
							<h2>{$vo['info']['title']}</h2>
						</div>
						<div class="menu-box-itme">
							<foreach name="vo['items']" item="o" key="menu">
								<a href="/algorithm/platform?pid={$o['path']}">
									<div class="class-menu">
										<div class="menu-icon">
											<!-- <i class="iconfont {$o['icon']} f80"></i> -->
											<img src="{$o['icon']}" alt="" width="250px" height="160px">
										</div>
										<div class="menu-title">
											{$o['title']}
										</div>
									</div>
								</a>
							</foreach>
						</div>
					</div>
				</foreach>
			</div>
			<else/>
			<span class="red f40">数据错误</span>
		</if>
		<else/>
		<div style="padding-right:20px;width:700px;margin:0 auto;">
			<div>
				<div style="font-size: 20px;width: 100%;text-align:center;margin-bottom: 10px;">
					{$menu[0]['info']['title']}
				</div>
				<div>
					策略说明：
					<div style="font-size:14px;margin-bottom:10px;text-indent: 2em;border:1px solid #d1d1d1;min-height:10px;padding:10px;">
						{$menu[0]['info']['info']}
					</div>
				</div>
				<div class="red" style="margin-top:1px;">
					使用说明：
					<div style="font-size:14px;margin-bottom:10px;text-indent: 2em;border:1px solid #d1d1d1;min-height:10px;padding:10px;">
						如果要使用该策略包中的思路，您可以选择复制整套思路也可以选择复制单个思路到你自己账户的思路中，特别提醒：由于思路中有很多参考指标都是固定值，该值都是团队人员总结出的经验值，具有较好的参考性，但建议使用时根据自己账户的特点进行适当修正。
					</div>
				</div>
				<div class="red" style="margin-top:1px;margin-bottom:10px;">
					策略操作：
					<button class="stdbtn think-copy" data-rel="multi" data-path="{$menu[0]['info']['path']}">复制策略到我的思路</button>
				</div>
				<div>
					<table cellpadding="0" cellspacing="0" border="0" class="metrotable datatable">
						<thead id="">
						<tr>
							<th width="5%" class="head1">ID</th>
							<th width="13%" class="head0">思路</th>
							<th class="head1">内容</th>
							<th class="head0">来自</th>
							<th width="15%" class="head1">创建日期</th>
							<th width="15%" class="head0">操作</th>
						</tr>
						</thead>
						<tbody id="con-list-tr">
						<if condition="$list['total_items'] == 0">
							<tr>
								<td colspan="6">暂无思路</td>
							</tr>
							<else/>
							<volist name="list['items']" id="v">
								<tr <if condition="$v.status eq 2">class="red"</if>>
								<td>{$v.id}</td>
								<td>{$v.title}</td>
								<td>
									{$v.content}
								</td>
								<td width="100">
									思路平台
								</td>
								<td>{$v.add_time}</td>
								<td>
									<a href="javascript:;" class="think-execute" data-id="{$v.id}">执行思路</a>
									<br>
									<a href="javascript:;" class="think-copy" data-id="{$v.id}" data-rel="single">复制到我的思路</a>
									<br>
									<if condition="$user_id eq -1423">
										<a href="javascript:;" class="think-delete" data-id="{$v.id}">删除</a>
										<br>
										<a href="javascript:;" class="think-edit" data-id="{$v.id}">编辑</a>
									</if>
								</td>
								</tr>
							</volist>
						</if>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<script>
			$('.think-execute').click(function() {
				siluHelper.execute({
					id: $(this).data('id'),
					campaign_id:'',
					adgroup_id: ''
				});
			});
			$(".think-edit").click(function() {
				var p = {
					edit : true,
					silu_id : $(this).data('id')
				};
				siluHelper.setParams(p);
				siluHelper.init();
			});

			$(".think-copy").click(function() {
				var $this = $(this),
						rel = $this.data('rel'),
						params = {
							user_id : {$user_id}
						};
				wt.showBox('确定要复制到我的思路中吗?', '温馨提示', function(r) {
					if(r) {
						switch(rel) {
							case 'multi':
								params.path_id = $this.data('path');
								break;
							case 'single':
								params.silu_id = $this.data('id');
								break;
						}
						params.method = rel;
						wt.post('/algorithm/cpoySilu', params, function(r) {
							var o = $.parseJSON(r);
							if(o.data.status == 1) {
								window.location.href="/algorithm/condition";
							} else {
								wt.showBox(o.data.msg, '温馨提示');
							}
						});
					}
				});
			});

			$(".think-delete").click(function() {
				var $this = $(this),
						id = $this.data('id');
				wt.showBox('确认删除思路(<span class="red">删除是直接删除并不是回到我的思路中，切记</span>)' , '提示', function(an){
					if(an){
						wt.ajax('/algorithm/delete', 'post', {id:id}, function(o) {
							var r = $.parseJSON(o);
							if(r.data.code == 'success') {
								$this.parents('tr').remove();
							}
						})
					}
				});
			});
		</script>
	</if>
</div>
</div>